<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
if(isset($_SESSION['lang']))
    require_once "./language_files/sessionPage_" . $_SESSION['lang'] . ".php";
else
    require_once "./language_files/sessionPage_en.php";
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <link href="style3.css" rel="stylesheet" type="text/css" />
        <?php include 'jquery.php';?>
        <script type="text/javascript" src="functions.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                check_top();
            });
        </script>
        <title></title>
    </head>
    <body>
        <!-- created a table in order to retrieve the data from the session  table in the database and to show it in order in the made table on the webpage -->
        <h1><?php
        require_once "functions.php";
        $confID=mysql_real_escape_string($_GET['conference_id']);
        $getCName=get_conference_name($confID);
        echo formatText_safe($getCName);
        ?></h1>
        <!-- h2 is to get ho many sessions is in this conference -->
        <h2 id="h2"></h2>
        <?php
        require_once "statics.php";
        $rsResult=rsSelect("*","session",array("conference_id=",$confID));
        echo "<script type='text/javascript'>document.getElementById('h2').innerHTML='" . mysql_num_rows($rsResult) . $lang['exist'] . "';</script>";
        ?>
        <table>
            <tr>
                <td><?php echo $lang['session'];?></td><td><?php echo $lang['date'];?></td><td><?php echo $lang['papers'];?></td>
            </tr>
            <?php
            $num=1;
            // entering session information
            if(mysql_num_rows($rsResult) > 0)
            {
                echo "<tr>";

                while($row=mysql_fetch_assoc($rsResult))
                {
                    $date=formatText_safe($row['session_date']);
                    echo "<td>" . $num++ . "</td><td>" . $date . "</td>";
                    // getting all papers belonging to this conference and included in this session
                    $rsPapers=rsSelect("*","paper",array('conference_id=',$row['conference_id'],"AND","session_id=",$row['session_id']));
                    echo "<td><ul>";
                    // iterate over the lis of papers and add an anchor for each that redirects to a page where you can view he pdf
                    while($rowPapers=mysql_fetch_assoc($rsPapers))
                    {
                        $pTitle=formatText_safe($rowPapers['paper_title']);
                        echo "<li><a target='_blank' href='viewPdf.php?paper_id=" . $rowPapers['paper_id'] . "'>" . $pTitle . "</a></li>";
                    }
                    echo "</ul></td>";
                }
                echo "</tr>";
            }
            // End of documentation
            ?>
        </table>
    </body>
</html>